//修改变量模块
import axios from 'axios'

const $host = 'http://132.232.110.185/personnelManagement'
export default {
    namespaced: true,
    actions: {
        async variableUpdate(ctx, obj) {
            await axios({
                method: 'POST',
                url: '/var/editVar',
                headers: {
                    'Content-Type': 'application/json'
                },
                data: {
                    "vId": obj.vId,
                    "vInfo": obj.vInfo,
                    "vName": obj.vName,
                    "vValue": obj.vValue
                }
            }).then(res => {
                ctx.commit('updateSuccess')
            })
        }
    },
    mutations: {
        //关闭模态框
        closeDialog(state) {
            state.form.variableFormVisible = false
        },
        //配置变量修改
        handleVariableEdit(state, row) {
            state.form.variableFormVisible = true
            state.updateForm = row
        },
        //修改参数
        updateSuccess(state) {
            state.form.variableFormVisible = false
            console.log('修改成功！！')
        }
    },
    state: {
        //表单数据
        form: {
            vName: '',
            vSrp: '',
            vNum: 1,
            vCnt: '',
            //模态框是否展示
            variableFormVisible: false,
        },
        updateForm: {},
    },
    getters: {}
}